﻿<?php
header("content-type:text/html;charset=utf-8");
session_start();
include("../includes/conn.php");
$dbconn->admin_logincheck();
$condition = isset($_GET['condition'])?$_GET['condition']:'';
$condition = str_replace("\'", "'", $condition);
//echo $condition;exit;
if ($condition)
{
	$sql=" select * from ".DBQIAN."exchangedg where ".$condition." order by id desc limit 0, 65000";
}
else 
{
	$sql=" select * from ".DBQIAN."exchangedg order by id desc limit 0, 65000";
}
$result = mysql_query($sql);
header ( "Content-type:application/vnd.ms-excel" );
header ( "Content-Disposition:filename=红包领取信息.xls" );
echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<title>红包领取信息</title>
<style>
td{
    text-align:center;
    font-size:12px;
    font-family:Arial, Helvetica, sans-serif;
    border:#1C7A80 1px solid;
    color:#152122;
    width:100px;
}
table,tr{
    border-style:none;
}
.title{
    background:#7DDCF0;
    color:#FFFFFF;
    font-weight:bold;
}
</style>
</head>
 
<body>
<table width='800' border='1'>
  <tr>
    <td class='title'>手机号码</td>
    <td class='title' style='width:100px;text-align:center;'>真实姓名</td>
    <td class='title'>性别</td>
    <td class='title'>省份</td>
    <td class='title'>城市</td>
    <td class='title'>门店名称</td>
    <td class='title'>门店地址</td>
    <td class='title'>防伪码</td>
    <td class='title'>金额</td>
    <td class='title' style='width:200px;text-align:center;'>领取时间</td>
    <td class='title'>微信号</td>
    <td class='title'style='width:500px;text-align:center;'>微信openID</td>
  </tr>";
  
while($row=mysql_fetch_array($result))
{
	$dg = mysql_fetch_array(mysql_query("select * from ".DBQIAN."daogou where username='".trim($row['username'])."' order by id desc limit 1"));
  echo "<tr>
    <td>".$row['username']."</td>
    <td>".$dg['name']."</td>
    <td>".$dg['sex']."</td>
    <td>".$dg['province']."</td>
    <td>".$dg['city']."</td>
    <td>".$dg['shopname']."</td>
    <td>".$dg['shopaddress']."</td>
    ";
    echo "<td>".$row['fwm']."</td>
    <td>".$row['credit']."元</td>
    <td>".$row['time']."</td>
    <td>".$dg['wx_user']."</td>
    <td>".$dg['wx_openid']."</td>";
  echo "</tr>";
}
echo "
</table>
</body>
</html>
";exit;
?>